package command.empresa;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import command.ICommand;

import dao.EmpresaDAO;

public class DeletarEmpresaCommand implements ICommand{
	
	public String execute(HttpServletRequest request) throws ServletException,IOException {
		String cod = request.getParameter("codigo");
		int codigo = Integer.parseInt(cod);
		EmpresaDAO empDAO = new EmpresaDAO();
		try {
			empDAO.deletar(codigo);
			return "controller.do?acao=listarEmpresas";
		} catch (SQLException e) {
			e.printStackTrace();
			return "/Paginas/empresa/inserir_empresa.jsp?erro=1";
		}
	}
	

}
